package com.noodles.mall.controller;


import com.noodles.mall.service.ItemRecommendService;
import com.noodles.mall.vo.PageVo;
import com.noodles.mall.web.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/** 商品推荐 **/
@RestController
@RequestMapping("/item-recommend")
public class ItemRecommendController {
    @Autowired
    private ItemRecommendService itemRecommendService;

    /**
     * 查询某用户的推荐商品列表
     * @param userId
     * @param current
     * @param size
     * @return
     */
    @RequestMapping("/selectPage/{current}/{size}/{userId}")
    public JsonResult selectPage(@PathVariable(value = "current") Long current,
                                      @PathVariable(value = "size") Long size,
                                      @PathVariable(value = "userId") Integer userId) {
        System.out.println("ItemController: selectRecommend");
        System.out.println("userId: "+userId);
        System.out.println("current: "+current);
        System.out.println("size: "+size);
        PageVo pageVo = itemRecommendService.selectRecommend(userId, current, size);
        return JsonResult.success(pageVo);
    }
}
